package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.exception.ParameterException;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.tags.Param;

/**
 * @author stone
 * @date 2021/11/24 10:51
 */
@RestController
public class HelloController {

    @RequestMapping("hello/{username}")
    public BaseRespVo hello(@PathVariable("username") String username) throws ParameterException {
        if ("songge".equals(username)) {
            int i = 1 / 0;
        }
        if ("ligenli".equals(username)) {
            throw new ParameterException("天明妈妈失去网名");
        }
        return BaseRespVo.ok(username);
    }
}
